unit uButtonManager;

{$mode objfpc}{$H+}

interface

uses
    Classes, SysUtils, BCButton, BCTypes;

type

    { TBCButtonStyle }

    TBCButtonStyle = class
    private
        FRounding: TBCRounding;
        FStateClicked: TBCButtonState;
        FStateHover: TBCButtonState;
        FStateNormal: TBCButtonState;
        procedure SetRounding(AValue: TBCRounding);
        procedure SetStateClicked(AValue: TBCButtonState);
        procedure SetStateHover(AValue: TBCButtonState);
        procedure SetStateNormal(AValue: TBCButtonState);
    protected
    public
        constructor Create;
        destructor Destroy;

        procedure SaveToFile(const AFileName: string);
        procedure LoadFromFile(const AFileName: string);

        procedure AssignTo(AButton: TBCButton);

        property Rounding: TBCRounding read FRounding write SetRounding;
        property StateNormal: TBCButtonState read FStateNormal write SetStateNormal;
        property StateHover: TBCButtonState read FStateHover write SetStateHover;
        property StateClicked: TBCButtonState read FStateClicked write SetStateClicked;
    end;

var
    PageButtonNDNormal, PageButtonNDSelected: TBCButtonStyle;


implementation

{ TBCButtonStyle }

procedure TBCButtonStyle.SetRounding(AValue: TBCRounding);
begin
    if FRounding = AValue then
        Exit;
    FRounding := AValue;
end;

procedure TBCButtonStyle.SetStateClicked(AValue: TBCButtonState);
begin
    if FStateClicked = AValue then
        Exit;
    FStateClicked := AValue;
end;

procedure TBCButtonStyle.SetStateHover(AValue: TBCButtonState);
begin
    if FStateHover = AValue then
        Exit;
    FStateHover := AValue;
end;

procedure TBCButtonStyle.SetStateNormal(AValue: TBCButtonState);
begin
    if FStateNormal = AValue then
        Exit;
    FStateNormal := AValue;
end;

constructor TBCButtonStyle.Create;
begin
    FStateNormal := TBCButtonState.Create(nil);
    FStateHover := TBCButtonState.Create(nil);
    FStateClicked := TBCButtonState.Create(nil);
    FRounding := TBCRounding.Create(nil);
end;

destructor TBCButtonStyle.Destroy;
begin
    FStateNormal.Free;
    FStateHover.Free;
    FStateClicked.Free;
    FRounding.Free;
end;

procedure TBCButtonStyle.SaveToFile(const AFileName: string);
begin

end;

procedure TBCButtonStyle.LoadFromFile(const AFileName: string);
begin

end;

procedure TBCButtonStyle.AssignTo(AButton: TBCButton);
begin
    AButton.StateNormal.Assign(StateNormal);
    AButton.StateHover.Assign(StateHover);
    AButton.StateClicked.Assign(StateClicked);
    AButton.Rounding.Assign(Rounding);
end;

initialization
    PageButtonNDNormal := TBCButtonStyle.Create;
    PageButtonNDSelected := TBCButtonStyle.Create;

finalization
    PageButtonNDNormal.Free;
    PageButtonNDSelected.Free;

end.
